<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('品牌信息列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>公司名称：</label>
                            <input type="text" name="company"/>
                        </li>
                        <li>
                            <label>客户姓名：</label>
                            <input type="text" name="name"/>
                        </li>
                        <li>
                            <label>所属区域：</label>
                            <select name="province" id="province">
                                <option value="">请选择省份</option>
                            </select>
                            <select name="sysCityId" id="city">
                                <option value="">请选择城市</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('market:look:edit')}]];
    var detailFlag = [[${@permission.hasPermi('market:look:detail')}]];
    var removeFlag = [[${@permission.hasPermi('market:look:remove')}]];
    var prefix = ctx + "market/look";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            detailUrl: prefix + "/detail/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "客户信息",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '序号',
                    visible: false
                },
                {
                    title: '序号',
                    formatter:function (value,row,index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'name',
                    title: '客户姓名'
                },
                {
                    field: 'sex',
                    title: '性别'
                },
                {
                    field: 'telephone',
                    title: '联系电话'
                },
                {
                    field: 'company',
                    title: '所属公司'
                },
                {
                    field: 'city.cityName',
                    title: '所属区域'
                },
                {
                    field: 'distracTime',
                    title: '分配时间'
                },
                {
                    field: 'sysServiceUser.userName',
                    title: '客户人员'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')" ><i class="fa fa-edit"></i>查看详情</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
<script>
    $(function () {
        $.get("/common/plist",'',function (data) {
            var plist="<option value=\"\">请选择省份</option>";
            $(data).each(function (i,e) {
                plist+="<option value='"+e.provId+"'>"+e.provName+"</option>";
            });
            $("#province").html(plist);
        },'json');

        $("#province").change(function () {
            var pid=$(this).val();
            $.get("/common/clist?pid="+pid,'',function (data) {
                var clist=" <option value=\"\">请选择城市</option>";
                $(data).each(function (i,e) {
                    clist+="<option value='"+e.cityId+"'>"+e.cityName+"</option>";
                });
                $("#city").html(clist);
            },"json");
        });
    });
</script>
</body>
</html>